/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.testapp.timemanagment.controllers;

import com.testapp.timemanagment.models.Account;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author admin
 */
@Controller(value = "apiController")
public class ApiController {
	
	@RequestMapping("api/test.htm")
	public ModelAndView apiHandler() {
		ModelAndView mav = new ModelAndView("newJsonView");
                mav.addObject("status", HttpServletResponse.SC_BAD_REQUEST);
                mav.addObject("message", "Some test message");
		return mav;
	}
        
        @RequestMapping("api/getTestJson.htm")
	public ModelAndView apiGetTestHandler() {
		ModelAndView mav = new ModelAndView("jsonView");
                Account account = new Account();
                account.setFirstName("Alex");
                account.setEmail("test@mail.com");

		mav.addObject("account",account);
                mav.addObject("status", HttpServletResponse.SC_ACCEPTED);
		
		return mav;
	}
	
}
